{extend name="base:base-add" /}
{block name="title"}
<title>添加分类</title>
{/block}
{block name="style"}
<link href="__LIB__/uploadify/uploadify.css" rel="stylesheet" type="text/css"/>
{/block}
{block name="form"}
<form  method="post" class="form form-horizontal" id="form-article-add">
    <div class="row clearfix">
        <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>所属分类：</label>
        <div class="form-controls col-xs-8 col-sm-2">
            <span class="select-box">
                <select name="c_id" class="select">
                {volist name="to_level" id="vo"}
                    <option value="{$vo.id}">|-{$vo.delimiter}{$vo.name}</option>
                {/volist}
                </select>
            </span>
        </div>
    </div>
    <div class="row clearfix">
        <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>标题：</label>
        <div class="form-controls col-xs-8 col-sm-6">
            <input type="text" class="input-text" value="" placeholder="" id="title" name="title">
        </div>
    </div>
    <div class="row clearfix">
        <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>关键字：</label>
        <div class="form-controls col-xs-8 col-sm-6">
            <input type="text" class="input-text" value="" placeholder="" id="keywords" name="keywords">
        </div>
    </div>
    <div class="row clearfix">
        <label class="form-label col-xs-4 col-sm-2">描述：</label>
        <div class="form-controls col-xs-8 col-sm-6">
            <textarea cols="" rows="" class="textarea textarea-article"  placeholder="说点什么...最少输入10个字符" name="description"></textarea>
        </div>
    </div>
    <div class="row clearfix">
        <label class="form-label col-xs-4 col-sm-2">排序值：</label>
        <div class="form-controls col-xs-8 col-sm-2">
            <input type="text" class="input-text" value="0" placeholder="" id="listorder" name="listorder">
        </div>
    </div>

    <div class="row clearfix">
        <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
            <button  class="btn btn-secondary radius add" type="button"><i class="Hui-iconfont">&#xe632;</i>
                保存
            </button>
        </div>
    </div>
</form>
{/block}
{block name="script"}
<script src="__LIB__/uploadify/jquery.uploadify.min.js"></script>
<script>
    $(".add").click(function () {
        var postData = {};
        var data = $("form").serializeArray();
        $.each(data, function () {
            postData[this.name] = this.value
        });
        $.ajax({
            url: "/wavlink/files/add.html",
            type: "post",
            data: postData,
            "success": function (result) {
                var msgData = JSON.parse(result);
                if (msgData.status === true) {
                    layer.msg(msgData.message, {icon: 1, time: 1000}, function () {
                        window.parent.location.href = msgData.url
                    })
                } else {
                    layer.msg(msgData.message, {icon: 5, time: 2000})
                }
            }
        }, JSON);
    });
</script>
{/block}